﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UMLDesigner
{
    public partial class RelationWindow : Form
    {
        public RelationWindow(RelationView rel)
        {
            InitializeComponent();
            textBoxName.Text = rel.GetRelationData().GetName();
            textBoxIniCardinal.Text = rel.GetRelationData().GetIniCardinality();
            textBoxEndCardin.Text = rel.GetRelationData().GetEndCardinality();
            textBoxNameEndAttr.Text = rel.GetRelationData().GetAttrNameEnd();
            textBoxNameIniAttr.Text = rel.GetRelationData().GetAttrNameIni();
            listBoxFinalVisibility.Items.AddRange(VisibilityType.GetTypes());
            listBoxIniVisibility.Items.AddRange(VisibilityType.GetTypes());
            listBoxFinalVisibility.Text = rel.GetRelationData().GetVisibilityEndAttribute();
            listBoxIniVisibility.Text = rel.GetRelationData().GetVisibilityIniAttribute();
        }

        private void RelationWindow_Load(object sender, EventArgs e)
        {
            
        }

        private void bttnAccept_Click(object sender, EventArgs e)
        {
            WindowsManager.EditRelation(textBoxName.Text, textBoxIniCardinal.Text, textBoxEndCardin.Text, textBoxNameIniAttr.Text, textBoxNameEndAttr.Text, listBoxIniVisibility.Text, listBoxFinalVisibility.Text);
            Close();
        }

        private void bttnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }


       
    }
}
